<template>
  <div class="allScore">
    <div style="float: right">
      <el-select v-model="value" placeholder="请选择" @change="getScore">
        <el-option
          v-for="item in options"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        >
        </el-option>
      </el-select>
    </div>
    <el-table :data="allscore">
      <el-table-column prop="studentnumber" label="学号"> </el-table-column>
      <el-table-column prop="classname" label="课程名"> </el-table-column>
      <el-table-column prop="score" label="分数"> </el-table-column>
      <el-table-column prop="grade" label="评级"> </el-table-column>
    </el-table>
  </div>
</template>
<script>
import axios from "axios";
import { path } from "../config.json";
export default {
  name: "AllScore",
  data() {
    return {
      account: sessionStorage.getItem("account"),
      allscore: [],
      options: [
        {
          value: "2018下",
          label: "2018下",
        },
        {
          value: "2019上",
          label: "2019上",
        },
        {
          value: "2019下",
          label: "2019下",
        },
        {
          value: "2020上",
          label: "2020上",
        },
        {
          value: "2020下",
          label: "2020下",
        },
      ],
      value: "2018下",
    };
  },
  methods: {
    getScore(xueqi) {
      axios({
        method: "post",
        url: path + "/Sc/getAllScore",
        data: {
          studentnumber: this.account,
          xueqi: xueqi,
        },
      }).then((response) => {
        this.allscore = response.data;
      });
    },
  },
  mounted() {
    this.getScore(this.value);
  },
};
</script>